package com.liuhouse1.service.impl;

import com.liuhouse1.mapper.StudentMapper;
import com.liuhouse1.pojo.Student;
import com.liuhouse1.service.StudentService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

@Service
public class StudentServiceImpl implements StudentService {

    @Resource
    private StudentMapper studentMapper;


    @Transactional
    @Override
    public Integer addStudent(Student student) {
        int num = studentMapper.insert(student);
        System.out.println("addStudent添加学生数据!!");
        //在此构造器,抛出异常
//        int i = 2 / 0;
        return num;
    }
}
